﻿using Autofac;
using NLog;
using ZoneLine.Common;
using ZoneLine.Models.StationConfig;
using ZoneLine.Stations;
using ZoneLine.Stations.XWStation;
using ZoneLine.ViewModels;

namespace DBContext
{
    public class ContainerServer
    {
        public static ILogger logger = LogManager.GetCurrentClassLogger();

        public static IContainer Container { get; set; }

        static ContainerServer()
        {
            var builder = new ContainerBuilder();

            builder.RegisterType<EVDal>().As<IModelDAL>();
            //builder.RegisterType<PicManager>().As<IPictureManager>();
            //builder.RegisterType<LogicMaster>();
            //builder.RegisterType<WorkPieceInfoViewModel>();
            //builder.RegisterType<QueryPieceChecktViewModel>();
            //builder.RegisterType<UploadPicService>();
            //builder.RegisterType<QueryCheckResultViewModel>();
            builder.RegisterType<MainViewModel>().SingleInstance();
            builder.RegisterType<HOpMainViewModel>().SingleInstance();
            builder.RegisterType<XWOpMainViewModel>().SingleInstance();

            builder.RegisterType<PackageBoxViewModel>().SingleInstance();
            builder.RegisterType<HistoryViewModel>();
            builder.RegisterType<StationResultInfoViewModel>();
            builder.RegisterType<PrintConfigTotal>().SingleInstance();
            builder.RegisterType<StationConfigViewModel>();
            builder.RegisterType<HStationConfigViewModel>();
            builder.RegisterType<StationResultViewModel>();
            builder.RegisterType<XWStationConfigViewModel>();
            builder.RegisterType<LableCompenstateViewModel>();
            builder.RegisterType<PackageReplaceViewModel>();
            builder.RegisterType<InventoryViewModel>();//add

            builder.RegisterType<PieceIndexViewModel>();

            builder.RegisterType<QOP006Station>().SingleInstance();
            builder.RegisterType<QOP010Station>().SingleInstance();
            builder.RegisterType<QOP020Station>().SingleInstance();
            builder.RegisterType<QOP050LStation>().SingleInstance();
            builder.RegisterType<QOP050RStation>().SingleInstance();

            builder.RegisterType<HOP010Station>().SingleInstance();
            builder.RegisterType<HOP040Station>().SingleInstance();

            builder.RegisterType<XW010SStation>().SingleInstance();
            builder.RegisterType<XW010LStation>().SingleInstance();
            builder.RegisterType<XW010RStation>().SingleInstance();

            Container = builder.Build();
        }
    }
}